package com.zq.it.cms.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
/**
 * @author zhengqiang
 * @description 用户角色中间表
 */
@Entity
@Table(name = "cms_user_role")
public class UserRole implements Serializable{
	@Id
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id", nullable = false, columnDefinition = "bigint(20) NOT NULL COMMENT '对应用户ID'")
	private User user;

	@Id
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "role_id", nullable = false, columnDefinition = "bigint(20) NOT NULL COMMENT '对应角色ID'")
	private Role role;
	
	@Column(columnDefinition = "int(11) NOT NULL COMMENT '排序值'")
	private int  roleIndex;

	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public Role getRole() {
		return role;
	}
	public void setRole(Role role) {
		this.role = role;
	}
	public int getRoleIndex() {
		return roleIndex;
	}
	public void setRoleIndex(int roleIndex) {
		this.roleIndex = roleIndex;
	}
}
